package com.ylr.admin.framework.mapper;

import com.ylr.admin.framework.entity.RoleUserEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2023-04-21 11:44:48
 * className: RoleUserMapper
 * version: 1.0
 * description:
 */
public interface RoleUserMapper extends BaseMapper<RoleUserEntity> {

    /**
     * 查询角色已关联的用户主键集合
     * @param roleId       角色主键
     * @param deleteStatus 删除状态
     * @return 用户主键集合
     */
    Set<Long> findUserIdSet(@Param("roleId") Long roleId, @Param("deleteStatus") Integer deleteStatus);

    /**
     * 查询用户已关联角色的主键集合
     * @param userId       用户主键
     * @param deleteStatus 删除状态
     * @return 角色主键集合
     */
    Set<Long> findRoleIdSet(@Param("userId") Long userId, @Param("deleteStatus") Integer deleteStatus);

    /**
     * 查询角色关联的用户主键
     * @param roleKey      角色键
     * @param deleteStatus 删除状态
     * @return 用户主键列表
     */
    List<Long> selectUserIdList(@Param("roleKey") String roleKey, @Param("deleteStatus") Integer deleteStatus);
}
